import { assertEquals } from "asserts";

import countOfAtoms from "./index.ts";

Deno.test("number-of-atoms", () => {
    const map = {
        "((N7Li31C7B10Be37B23H2H11Li40Be15)26(OBLi48B46N4)25(O48C22He)2N10O34N15B33Li39H34H26B15B23C31(C36N38O33Li38H15H46He21Be38B50)8)3":
            "B7512Be4968C1635H2658He510Li10167N1833O1257",
        "((N42)24(OB40Li30CHe3O48LiNN26)33(C12Li48N30H13HBe31)21(BHN30Li26BCBe47N40)15(H5)16)14":
            "B18900Be18984C4200H5446He1386Li33894N50106O22638",
        "((HHe28Be26He)9)34": "Be7956H306He8874",
        "(Li12B17Be11)5": "B85Be55Li60",
        "(H12H8Li20B4)47": "B188H940Li940",
        "(B2O39He17BeBe49)39": "B78Be1950He663O1521",
        "(NB3)33": "B99N33",
        H11He49NO35B7N46Li20: "B7H11He49Li20N47O35",
        H2O: "H2O",
        "Mg(OH)2": "H2MgO2",
        "K4(ON(SO3)2)2": "K4N2O14S4",
        "(N13O9Be)37(LiC50B35)38(Li33HHBe14He5ON50N)27(H3C)2He14C34Li33C33He15N14N5Li24Li17H28O13H42(HeHe6CO11Li)35(He3O27HO5N21H49O39CH37B3)8(O41He27He46He22He17)12":
            "B1354Be415C2012H826He1777Li1038N2045O1818",
        "((Li4N24B16B25Li38HeH36Be)15(He30C23H2C4He36Be50)37)37":
            "B22755Be69005C36963H22718He90909Li23310N13320",
        "(Cm39)5(Ga28Sb45Rb8)20(Bk13Fr29As)45":
            "As45Bk585Cm195Fr1305Ga560Rb160Sb900",
        "(Cr36At29)10(KrHs9Fm20Y)28(Md4Sc19I36)2":
            "At290Cr360Fm560Hs252I72Kr28Md8Sc38Y28",
        "(ScTh13)16Tb22C18Fl34Ag14(At41Bk4NpEsTc27Am20)3":
            "Ag14Am60At123Bk12C18Es3Fl34Np3Sc16Tb22Tc81Th208",
        "Nd37At28In40Si48Ti38Ds37Sm(Ho26No38)7(Tm35)24Li14Mo34(Nb7Te45Bk35Sr27Yb11Yb18Rn31)10(Po8)30(Ra)27As7Ir38Mt46BaTi37Np43Sm19Mo46Hs37Ga44ZrAu7Pb44Ca48PaNa15Ds4Ac9(Co2Cd39)5(Lv5Ga36No31Si8)16":
            "Ac9As7At28Au7BaBk350Ca48Cd195Co10Ds41Ga620Ho182Hs37In40Ir38Li14Lv80Mo80Mt46Na15Nb70Nd37No762Np43PaPb44Po240Ra27Rn310Si176Sm20Sr270Te450Ti75Tm840Yb290Zr",
        "(Fe10Ds47)34Nh13Bi21Cd7Tc29Ru45Ne33(Ts9He15Cs38Md30Ne23Gd5)15HAl27Eu36(Ta33Mn25Hg20Ir42Er50Cd5Pa35K)43":
            "Al27Bi21Cd222Cs570Ds1598Er2150Eu36Fe340Gd75HHe225Hg860Ir1806K43Md450Mn1075Ne378Nh13Pa1505Ru45Ta1419Tc29Ts135",
        "(Db40Hs6Sc10I28IrBe22)8((Np25Lu36Ge46)46(Ta28Lv16Fe38Sn11PbCa23Ta37)26(Li35Hf11I38Po43Sg10Tl19BrZn24)19(Au3CePa23Ac36Hs7Es35AlTlGdRa7)34(Nb38Cu7Cd14)16)13":
            "Ac15912Al442Au1326Be176Br247Ca7774Cd2912Ce442Cu1456Db320Es15470Fe12844Gd442Ge27508Hf2717Hs3142I9610Ir8Li8645Lu21528Lv5408Nb7904Np14950Pa10166Pb338Po10621Ra3094Sc80Sg2470Sn3718Ta21970Tl5135Zn5928",
        "(((U42Se42Fe10Mc31Rh49Pu49Sb49)49V39Tm50Zr44Og6)33((W2Ga48Tm14Eu46Mt12)23(RuRnMn11)7(Yb15Lu34Ra19CuTb2)47(Md38BhCu48Db15Hf12Ir40)7CdNi21(Db40Zr24Tc27SrBk46Es41DsI37Np9Lu16)46(Zn49Ho19RhClF9Tb30SiCuYb16)15)37(Cr48(Ni31)25(La8Ti17Rn6Ce35)36(Sg42Ts32Ca)37Tl6Nb47Rh32NdGa18Cm10Pt49(Ar37RuSb30Cm32Rf28B39Re7F36In19Zn50)46)38(Rh19Md23No22PoTl35Pd35Hg)41)50":
            "Ar3233800B3408600Bh12950Bk3914600Ca70300Cd1850Ce2394000Cl27750Cm2815800Cr91200Cu736300Db3598250Ds85100Es3489100Eu1957300F3396150Fe808500Ga2076600Hf155400Hg2050Ho527250I3148700In1660600Ir518000La547200Lu4317900Mc2506350Md539250Mn142450Mt510600Nb89300Nd1900Ni1511350No45100Np765900Og9900Pd71750Po2050Pt93100Pu3961650Ra1652050Re611800Rf2447200Rh4089150Rn423350Ru100350Sb6583650Se3395700Sg2952600Si27750Sr85100Tb1006400Tc2297700Ti1162800Tl83150Tm678200Ts2249600U3395700V64350W85100Yb1748250Zn5729750Zr2115000",
        "((Bi16LrSc30As49As23La13La(Ba21Re28BkRf40DbP29SeSe41La27Cn16)48(TcRn)49(Sb28Ti4Po35Mn16)21(Ta36Tl2Br5Dy21S41)6(Bh37Li36O20Tb48)24Cr43Pd11Pu39OgYb43Zr35FmHe44(Rh35BiLaCf4RnHLi10RgLuRg)3(Cn15PbS44Nd18)8)25((Hs11B41Rf46)20(At48Te45)32(Cs15Mt19OgHs34Ts5La33Ga23Np50Dy33O24)4)13((Po21ZnPdK27Pm16TlCo34Nd30Y4N)16(Nh2BaNa28Ga15LuAl38)17(Rb23ReRf2Rf33I32Te48Bh)50(Cf37Ne32W33BeRgIr21Cs34Mc17Zn43)43(Ho23ArEs38Er40Tb8DyIn41Tc36Hg21Cl9)42(Y8B25Ts16S10Fr2Lv22Po6)2(Zn46N34Ds7Sg20HoRf31P25ZrIHo22)40(FeRh50Kr9ThPt49)37(TaLrKr35Kr12SrCd26Xe28Mt26CnFl)43)23)17":
            "Al252586Ar16422As30600At339456B200770Ba435047Be16813Bh396950Bi8075Bk20400Br12750Cd437138Cf627181Cl147798Cn394213Co212704Cr18275Cs584902Db20400Ds109480Dy99144Er656880Es624036Fe14467Fl16813Fm425Fr1564Ga120037H1275He18700Hg344862Ho737426Hs78676I641240In673302Ir353073K168912Kr920414La587197Li379950Lr17238Lu7922Lv17204Mc285821Mn142800Mt453934N538016Na186116Nd248880Ne538016Nh13294Np44200O225216Og1309P982600Pb3400Pd10931Pm100096Po448443Pt708883Pu16575Rb449650Re590750Rf2188410Rg19363Rh767975Rn22100S261970Sb249900Sc12750Se856800Sg312800Sr16813Ta108613Tb620976Tc612017Te1256640Th14467Ti35700Tl11356Ts16932W554829Xe470764Y31280Yb18275Zn1448655Zr30515",
        "((Md16Cm19HfNe47K29(NeW42ZrPd9)17Ag7Ar6P9HsFr18Ar18O31Tc5Md42(W6Sn5Er29SB40Ho42Co31Si42)44)7(La24Au2Bh12MoFr11LaHf24Re13Bh20Sc2)41(Tb33BLi14Al35Cu14)9Rh5Tl(Cr3SNd20Fe)14B27Cf48H11Sb8Sb25HsRhCm40(Fe4Cs13At49)26((Co6RnMg15Be30Hs9)40(Rg43SNoCn29F)2(Md25DbMn27Ni41)22(Ac28Pu50PdHoNa50)40(Fm28B15In)16(Pb41PmHf24Zn4Ts39Np25Tl47Lu47)6(Ru3Ni20Sm35)16(Ru23RaAt5Cs15Ga)8(Ra26Sb16Cr44Ds25Ar23Pm34C49)6)41(ThBSc15W(Nh12Li42Ts5Sr11Mn2Ga22W3)40(Bh50No12Zr43Mo18As18Sc17Ti17Ca28Tc50)11)6(Pr(Sb46Dy14Fe11)42(Cd14AlPd28Li13Sm4Fm50F33Ti)38(Bk14Fl50)31)4(N18Am45Cl36(Pr32Ta3Am)39Th36Si50NiDsEr50Am8Co25Pu24Ts17Ge37Ce36Re10TcSnWZn38No35Ar18Rf33P8(La5)7(Lr43Sg40)36(Au12HfCr10Fr40)37)9((Mn15Co20U9)5LvRb48LrLv37No(Pt20Tl44Nd31Cu32Ga19Lu4Es35)29(Po47Te47Na29Nh48VF28O28Ti46Cu28)45(Co8Bh5)20)43)35":
            "Ac1607200Ag1715Al16345Am28980Ar209580As41580At101990Au142730B777070Be1722000Bh311920Bk60760C421890Ca64680Cd74480Ce11340Cf1680Cl11340Cm6055Cn83230Co1077755Cr496860Cs184030Cu3297350Db31570Ds215565Dy82320Er328370Es1527575F2074730Fe68810Fl217000Fm908880Fr486395Ga1025535Ge11655H385Hf252980Ho510160Hs516880In22960K7105La46900Li426370Lr489125Lu579250Lv57190Md803460Mg861000Mn982065Mo43015N5670Na4834025Nd1362795Ne15680Nh3351600Ni1753885No43120Np215250O1903895P4725Pb353010Pd243845Pm301350Po3183075Pr393260Pt872900Pu2877560Ra235340Rb72240Re21805Rf10395Rg123410Rh210Rn57400Ru332920S14140Sb409395Sc45290Sg453600Si468510Sm824880Sn54215Sr92400Ta36855Tb10395Tc117040Te3183075Th11550Ti3159940Tl2325085Ts383145U67725V67725W265335Zn46410Zr103495",
        "((Li18Rg)43(Cm19BePt21CmRbFe38Pm)17(Fr44Sn39)26(ZrNa7Nh39Re27Ir6)10(Ba24Fe31Nb32Nh13P7F21P49Dy20Er22Fm7)30ThBhNa10Sm17NCa13Nd15)45((Bk8Es26Lu24Y35Y12Md17Au10Po33Mt30Lr32)40)25((Tm38Zn14Th25Cd21Pb7Si5Bk38)13(Lr20)10(Lr41W40Lu31ZrN46AgHs10LuCe29)45(Ac25Ta31Fe49Sm41Ar29Ds32Zr21YbN7Fm40)46(Pr19Fe26KNe21Ni13As47)7S13Sb11K31Sn7He22O38Pt10Pd12W24(LaMn19Fl17Eu40Bk36)21(Re36CnTeW11Ra31Nh)32)39((Pb2He37Bi36Tm50Mt10Sr33C)13(Mn5Ds24IrRa16Pt26Fl32Hg11Po35)26(Cl4NeDy43Hg7Br28Te24)9(Pa23MtMnC45Li2)43(Ru45Be32Na49Tl13LvTs)27)11(LiCd12Ag6)26MoRa17Re19Ta40(Sb7At39)22(Am41Mo17Rn23Au46Hs16Ge9)45((RbEu27Gd17Cu48CeSi46Cm8Fe3)47(W37)15(ScNh7NHf14Pu35SgBiTm33Ra27)33(V35)48(Si33S35Y28SbAsPt3)21(Te17Kr38Na42Ir25Ba50Nd48LaTiCl30I13)36(Er2Ge34Nh5PmRf8Am4Mt47TbEr47Yb19)6)22(Fr48RgGd33Zn45Te3Xe43N38(Ti48)27(Ne31Lr19MdYb31PoCu16Mc43Zn34Au3)40)50((Fm40XeRb43K37Ra19Lr47)43(Fm12Ds45)30)30":
            "Ac44850Ag1911Am2373Ar52026As13293At858Au18070Ba72000Be10269Bh45Bi5874Bk56750Br2772C21428Ca585Cd10959Ce51929Cl24156Cm23572Cn1248Cu81632Ds104772Dy31257Er36168Es26000Eu60678F28350Fe169026Fl23075Fm143610Fr53880Gd19228Ge4893He6149Hf10164Hg3839Hs18270I10296Ir22786K49212Kr30096La1611Li35802Lr210385Lu80160Lv297Mc86000Md19000Mn17464Mo766Mt38107N95959Na51417Nb43200Nd38691Ne67832Nh42090Ni3549O1482P75600Pa10879Pb3835Pd468Pm897Po45010Pr5187Pt25277Pu25410Ra87393Rb57269Re57097Rf1056Rg1985Rn1035Ru13365S16677Sb1045Sc726Sg726Si65345Sm74319Sn45903Sr4719Ta55654Tb132Te17238Th12720Ti65592Tl3861Tm50374Ts297V36960W97074Xe3440Y59936Yb66302Zn77348Zr39879",
        "(H)": "H",
        "Mg(H2O)N": "H2MgNO",
        "Mg((H2O)2Na)4(F)(H2SO4)N": "FH18MgNNa4O12S",
    };
    assertEquals(Object.keys(map).map(countOfAtoms), Object.values(map));
});
